package multithreading.basal;

import multithreading.pool.Text3;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class MyText3 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        //创建一个callable线程来承接
       Callable<String> call= new Text3(20);
       //把callable对象封装成未来任务对象
        //未来任务对象：他是一个任务对象而且实现类runnable
        //线程执行完可以用get方法调取结果
        FutureTask<String> a=new FutureTask<>(call);
        new Thread(a).start();
        System.out.println(a.get());

    }
}
